<!-- src/components/admin/UserSearchResult.vue -->
<template>
    <div class="user-search-result">
        <h3>查询结果</h3>
        <el-table :data="users" style="width: 100%">
            <el-table-column prop="userid" label="ID" width="180"></el-table-column>
            <el-table-column prop="username" label="用户名" width="180"></el-table-column>
            <el-table-column prop="userphone" label="电话"></el-table-column>
            <el-table-column label="操作" width="200">
                <template #default="scope">
                    <el-button size="small" @click="handleEdit(scope.$index, scope.row)">编辑</el-button>
                    <el-button size="small" type="danger" @click="handleDelete(scope.row)">删除</el-button>
                </template>
            </el-table-column>
        </el-table>
    </div>
</template>

<script setup>
import { useUserStore } from '../../stores/userStore';
import { defineProps } from 'vue';
import { storeToRefs } from 'pinia';
const userStore = useUserStore();
const { users } = storeToRefs(userStore);

const props = defineProps({
    users: {
        type: Array,
        required: true
    },
    handleEdit: {
        type: Function,
        required: true
    },
    handleDelete: {
        type: Function,
        required: true
    }
});
</script>

<style scoped>
.user-search-result {
    padding: 1rem;
}
</style>